package com.hptpd.questionnairesurvey.vo;

import com.hptpd.questionnairesurvey.domain.Choice;
import com.hptpd.questionnairesurvey.utils.AbstractMyBeanUtils;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;


@Data
public class ChoiceVo {
    private String id;

    private String description;

    private Integer score;

    private boolean edit = false;

    public static ChoiceVo toVo(Choice choice) {
        ChoiceVo choiceVo = new ChoiceVo();
        AbstractMyBeanUtils.copyProperties(choice, choiceVo);
        return choiceVo;
    }

    public static List<ChoiceVo> toVos(List<Choice> choices) {
        List<ChoiceVo> choiceVos = new ArrayList<>();
        for (Choice choice : choices) {
            choiceVos.add(toVo(choice));
        }
        return choiceVos;
    }
}
